/*
 * EditTeam.java
 */

package nxtgeninventorysystem.View.Dialog;

import java.awt.event.ActionEvent;
import java.util.HashMap;
import javax.swing.AbstractAction;
import javax.swing.DefaultComboBoxModel;
import nxtgeninventorysystem.View.Gui;
import nxtgeninventorysystem.View.Gui.ComboBoxType;

/**
 * The dialog box that displays fields for editing teams.
 * @author Seraph Softworks
 */
public class EditTeam extends GuiDialog {

    /** Creates new form DatabaseConfig */
    public EditTeam(java.awt.Frame parent) {
        super(parent);
    }

    @Override
    public void resetFields() {
        newTeamValue.setText("");
    }

    public void setFields(String old) {
        oldTeamValue.setSelectedItem(old);
    }

    @Override
    public void refreshComboBoxes(HashMap<ComboBoxType, DefaultComboBoxModel> models) {
        oldTeamValue.setModel(models.get(Gui.ComboBoxType.TeamsComboBox));
    }

    @Override
    protected void initialize() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.JButton closeButton = new javax.swing.JButton();
        javax.swing.JButton okButton = new javax.swing.JButton();
        javax.swing.JLabel newTeamLabel = new javax.swing.JLabel();
        newTeamValue = new javax.swing.JTextField();
        oldTeamValue = new javax.swing.JComboBox();
        javax.swing.JLabel oldTeamLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(nxtgeninventorysystem.Driver.class).getContext().getResourceMap(EditTeam.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setMinimumSize(new java.awt.Dimension(295, 110));
        setName("Form"); // NOI18N
        setResizable(false);

        closeButton.setAction(new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
        closeButton.setText(resourceMap.getString("closeButton.text")); // NOI18N
        closeButton.setName("closeButton"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(nxtgeninventorysystem.Driver.class).getContext().getActionMap(EditTeam.class, this);
        okButton.setAction(actionMap.get("ok")); // NOI18N
        okButton.setText(resourceMap.getString("okButton.text")); // NOI18N
        okButton.setName("okButton"); // NOI18N

        newTeamLabel.setText(resourceMap.getString("newTeamLabel.text")); // NOI18N
        newTeamLabel.setName("newTeamLabel"); // NOI18N

        newTeamValue.setName("newTeamValue"); // NOI18N

        oldTeamValue.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--Select Team--" }));
        oldTeamValue.setName("oldTeamValue"); // NOI18N

        oldTeamLabel.setText(resourceMap.getString("oldTeamLabel.text")); // NOI18N
        oldTeamLabel.setName("oldTeamLabel"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(newTeamLabel)
                    .addComponent(oldTeamLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(oldTeamValue, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(newTeamValue, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(96, 96, 96)
                .addComponent(okButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(closeButton)
                .addContainerGap(91, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(oldTeamValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(oldTeamLabel))
                .addGap(8, 8, 8)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(newTeamLabel)
                    .addComponent(newTeamValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(closeButton)
                    .addComponent(okButton))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField newTeamValue;
    private javax.swing.JComboBox oldTeamValue;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the newTeamValue
     */
    public String getNewTeam() {
        return newTeamValue.getText();
    }

    /**
     * @return the oldTeamValue
     */
    public String getOldTeam() {
        return (String) oldTeamValue.getSelectedItem();
    }

}
